<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
require_once("class/fpdf.php");
require_once("class/fpdi.php");

global $path;
   $pdf = new FPDI();

  /* <Virtual loop> */
  $pdf->AddPage();
  $sourcepdf=$_REQUEST['path'];
  $page=$_REQUEST['page'];
  $event_id=$_REQUEST['event_id'];
  if (!empty($sourcepdf)){
  //$path=$sourcepdf;    
  if (!file_exists($sourcepdf)){
      die ("File does not exist!");
  }
  $pdf->setSourceFile($sourcepdf);
  if (empty($page)){
      $page=1;
  }
  $tplIdx = $pdf->importPage($page);

  $pdf->useTemplate($tplIdx, 10, 10, 200);

  // now write some text above the imported page
  $pdf->SetFont('Arial');
  $pdf->SetTextColor(255,0,0);
  $pdf->SetXY(10, 5);
  $pdf->Write(0, "INHERENT - DIKTI");

  /* </Virtual loop/> */

  

  $pdf->Output();
  $output="media/livemedia_$event_id".".pdf";
  $pdf->Output($output);
  }
?>
